/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package BESA.SystemLevel.transactions;

import BESA.SystemLevel.transactions.gca.GCA;
import BESA.util.ConfigTransactionalBESA;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 *
 * @author Andrea
 */
public class TransactionalBESA {
    private static GCA gca;

    public static void startGCA(){
        try {
            gca = new GCA();
            Registry reg = LocateRegistry.createRegistry(ConfigTransactionalBESA.getGCAPort());
            Naming.rebind(ConfigTransactionalBESA.getGCA_URL(), gca);
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }

    public static GCA getGCA(){
        return gca;
    }

}
